#include "pch.h"
#include "waterDemo.h"
#include "WaterEffect.h"
#include "Engine.h"
#include "Scene.h"
#include "Camera.h"
#include "Vector.h"
CWaterDemo::CWaterDemo()
{

}

CWaterDemo::~CWaterDemo()
{
	SafeDelete(mpWaterEffect);
}

void CWaterDemo::init(mini::CEngine* pEngine)
{
	mini::CWaterEffect* mpWaterEffect = new mini::CWaterEffect;
	mpWaterEffect->initialise("resource/Mesh/water.txt", "resource/Material/water.ma");
	mini::CCamera* pCamera = mini::GEngine->getCurrentScene()->getCamera();

	mpWaterEffect->setWaterHeight(2.75f);
	mpWaterEffect->setPosition(CVector(0, 2.75f, 0));

	mpWaterEffect->initReflection(pCamera);
	mpWaterEffect->initRefraction(pCamera);

	mini::CRenderNode* pRenderNode = pEngine->createRenderNode();
	pRenderNode->bindActor(mpWaterEffect, mini::RendererType::FrontRenderer);
	pEngine->getCurrentScene()->addRenderNode(pRenderNode);

}
